---
title: Trafilatura Tools
---

## Code

```python cookbook/tools/trafilatura_tools.py
from agno.agent import Agent
from agno.tools.trafilatura import TrafilaturaTools

agent = Agent(
    instructions=[
        "You are a web content extraction specialist",
        "Extract clean text and structured data from web pages",
        "Provide detailed analysis of web content and metadata",
    ],
    tools=[TrafilaturaTools()],
    markdown=True,
)

agent.print_response("Extract the main content from https://example.com/article")
```

## Usage

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Set your API key">
    ```bash
    export OPENAI_API_KEY=xxx
    ```
  </Step>

  <Step title="Install libraries">
    ```bash
    pip install -U trafilatura openai agno
    ```
  </Step>

  <Step title="Run Agent">
    <CodeGroup>
    ```bash Mac
    python cookbook/tools/trafilatura_tools.py
    ```

    ```bash Windows
    python cookbook/tools/trafilatura_tools.py
    ```
    </CodeGroup>
  </Step>
</Steps>
